home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-2.iso / Files II / Prog / B-C / CVScrollBar.sit / CVScrollBar / CVScrollBar.hpp < prev   
Encoding:
Text File  |  1994-04-03  |  3.7 KB  |  101 lines  |  [TEXT/KAHL]

  1. //CVScrollBar.hpp
  2. //Interface of the class CVScrollBar
  3. //Superclass - CScrollBar
  4. //Date - March 17, 1994
  5. //© 1994 by Vladimir Potap'yev, Manley & Associates, Inc.
  6.  
  7.  
  8. /****************************************************************************************************
  9.  
  10.     This subclass of CScrollBar is intended to serve as a substitute for CScrollBar class 
  11.     in TCL-based programs.  CScrollBar uses DoClick method inherited from CControl which is
  12.     rather anemic and does not provide such necessities as action procedure to be called 
  13.     when user is pressing mouse in stationary parts of the scroll bar or such goodies as 
  14.     "live scrolling".  All this is remedied in this class.
  15.     
  16.     This class adds an instance variable, itsScrollCmd, that srings to action at any time control
  17.     value in scroll bar has changed.  Another instance variable is itsPageValue.  We use it when
  18.     user is clicking in inPageDown or inPageUp so that we could scroll a "page" at a time.  Client
  19.     of the class has to figure out what this value will be for the intended use and set the
  20.     variable accordingly.  The real job of updating the scrolled area is entrusted
  21.     to the supervisor of the scroll bar.  The probable course of action will be upon receiving
  22.     the command from the scroll bar to get the current value and approprietly update the display.
  23.     All in all, I think this class is fairly complete, however, I would welcome any suggestions 
  24.     and improvements.
  25.     
  26.     I'd like to thank Chris Wysocki for his suggestion of how to implement "live scrolling".  He
  27.     described the general idea here at AOL, and I filled in the blanks.  There is one area which
  28.     needs to be worked on.  When you scroll very fast to the left or down (depending on the
  29.     orientation of the scroll bar) and get to the minimum value, the indicator sometimes jumps
  30.     to the maximum value.  I also noticed this behavior with the new Metrowerks compiler in their
  31.     implementation of "live scrolling".  I suspect that in these cases the new value to be
  32.     assigned to the contrlValue field is below minimum value allowed for this control, and
  33.     Control Manager compensates for it by moving it to the maximum.  Control value overflow, if
  34.     you will.  I tried to resolve this problem but was not very successful.  My only consolation
  35.     right now is that I am not the only one who got bit by this bug :-). I'll post the update when
  36.     I figure this one out.  Meanwhile, I'd be glad if someone else could come up with the
  37.     solution.
  38.     
  39.     Enjoy and make classes of your own available to general public as well.
  40.     
  41.     Vladimir Potap'yev,
  42.     Manley & Associates, Inc.
  43.     Issaquah, WA
  44.     VolodyaP at AOL
  45.     fax (206) 557-9039
  46.     
  47. ****************************************************************************************************/
  48.  
  49. //notice that we avoid #pragma once directive as it makes code unportable
  50.  
  51. #ifndef        CVScrollBar_H
  52. #define        CVScrollBar_H
  53.  
  54. #include <CScrollBar.h>
  55.  
  56.  
  57. class CVScrollBar : public CScrollBar
  58. {
  59.     protected:
  60.                             /*    Instance variables    */
  61.                     
  62.                     long    itsScrollCommand;
  63.                     
  64.                     short    itsPageValue;
  65.                     
  66.                             /*    Instance methods    */
  67.                 
  68.     public:
  69.     
  70.                         /*    Construction method        */
  71.                 
  72.                 void    IVScrollBar     (
  73.                                             CView             *anEnclosure,
  74.                                             CBureaucrat        *aSupervisor,
  75.                                             Orientation        anOrientation,
  76.                                             short            aLength,
  77.                                             short            aHEncl,
  78.                                             short            aVEncl
  79.                                         );
  80.                 
  81.                                         
  82.                     /*    Overridden methods    */
  83.                 
  84.                 void    DoClick (Point hitPt, short modifiers, long when);
  85.                 
  86.                 void    DoGoodClick (short whichPart);
  87.                 
  88.                     /*    Command methods        */
  89.                     
  90.                 void    SetScrollCmd (long aCommand);
  91.                 
  92.                 long    GetScrollCmd (void);
  93.                 
  94.                     /*    Other methods    */
  95.                 
  96.                 void    SetPageValue (short aValue);
  97.                 
  98.                 short    GetPageValue (void);
  99. };
  100.  
  101. #endif